import http from "@/api";
import { Agreement, App, Base, BaseType } from "@/api/interface/province/base";

// 获取意见反馈列表
export const getFeedbackListAPI = (params: { feedbackOrigin: string; status: string }) => {
  return http.get<Base.Row[]>("/manager/feedbackInfo/list", params, { loading: false });
};
// 获取反馈详情
export const getFeedbackDetailAPI = (ID: string) => {
  return http.get<Base.DataDetail>(`/manager/feedbackInfo/${ID}`);
};
// 反馈回复
export const feedbackReplyAPI = (data: { id: string; replyWay: string; replyContent: string }) => {
  return http.put("/manager/feedbackInfo", data);
};
// 反馈类型列表
export const getFeedbackTypeListAPI = (params: { useScope?: string }) => {
  return http.get<BaseType.Datum[]>("/manager/feedbackType/list", params);
};
// 添加反馈类型
export const addFeedbackTypeAPI = (data: BaseType.UpdateParams) => {
  return http.post("/manager/feedbackType", data);
};
// 修改反馈类型
export const updateFeedbackTypeAPI = (data: BaseType.UpdateParams) => {
  return http.put("/manager/feedbackType", data);
};
// 删除反馈类型
export const deleteFeedbackTypeAPI = (ids: string) => {
  return http.delete(`/manager/feedbackType/${ids}`);
};

// app管理
// 获取app列表
export const getAppListAPI = (params: { platform: string; type: string }) => {
  return http.get<App.Row[]>("/manager/appInfo/list", params);
};
// 获取app详情
export const getAppDetailAPI = (id: string) => {
  return http.get<App.Detail>(`/manager/appInfo/${id}`);
};
// 上传APP
export const uploadAppAPI = (data: App.UploadParams) => {
  // return http.post("/manager/appInfo", data, { headers: { "Content-Type": "multipart/form-data" } });
  return http.post("/manager/appInfo", data);
};
// 修改状态
export const updateAppStatusAPI = (data: { id: number; status: string }) => {
  return http.put("/manager/appInfo", data);
};

// 协议管理
// 获取协议列表
export const getProtocolListAPI = (params: { useScope: string; title: string }) => {
  return http.get<Agreement.Row[]>("/manager/agreement/list", params);
};
// 删除协议
export const deleteProtocolAPI = (ids: string) => {
  return http.delete(`/manager/agreement/${ids}`);
};
// 新增协议
export const addProtocolAPI = (data: Agreement.AddParams) => {
  return http.post("/manager/agreement", data);
};
// 修改协议
export const updateProtocolAPI = (data: Agreement.AddParams) => {
  return http.put("/manager/agreement", data);
};
// 查看协议详情
export const getProtocolDetailAPI = (id: string) => {
  return http.get<Agreement.Detail>(`/manager/agreement/${id}`);
};
